//tijiao 1
#include<bits/stdc++.h>
using namespace std;
const int N=10000+30;
int n,m,ans,cnt,cnt1,cnt2;
bool vis1[N],vis2[N];
struct Node
{
    int gj,num;
}a[N];
bool cmp(Node a,Node b)
{
    if(a.gj<=b.gj) return a.gj<=b.gj;
}
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    ans=n;
    for(int i=1;i<=n;i++)
    {
        cin>>m;
        if(m<=2)
            cnt++;
        if(m==1)
            cnt1++;
        a[i].gj=m;
        a[i].num=i;
        vis1[a[i].num]=true;
        vis2[a[i].num]=true;
    }
    if(cnt==n)
    {
        cout<<cnt1;
        return 0;
    }
    else
    {
        for(int i=1;i<=n;i++)
        {
            if(vis1[a[i].num])
            {
                for(int j=i+1;j<=n;j++)
                {
                    if((a[j].gj>a[i].gj)&&vis2[a[j].num]&&vis1[a[j].num])
                    {
                        ans--;
                        vis1[a[i].num]=false;
                        vis2[a[j].num]=false;
                        break;
                    }
                }
            }
        }
        cout<<ans;
        return 0;
    }
    return 0;
}
